Skip to content

feat(demo): add Production Mode as a dry-run warning - #18

Merged
tela merged 13 commits into
mainfrom
feat/production-mode
Nov 6, 2026
Merged

tela merged 13 commits into
mainfrom
feat/production-mode

Conversation

@tela

@tela tela commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The demo should show the mechanism behind "LocalStack for SaaS Applications": the app's code is the same whether it calls an app emulator or the real vendor, and only the base URL changes. Nobody should connect production credentials to a demo, so nothing is ever sent to a vendor. Production Mode shows the mechanism without breaking the demo.

Changes

  • shared/wire: add Switch, which holds the base URL each vendor has been pointed at, and a proxy that asks it for the target on every call. A vendor pointed at its own service's URL is still answered by the app emulator, and the recorded call carries would_send_to, the URL it would have gone to. An empty or malformed URL is reported in the state and fails the call that uses it with a message that says what to do.
  • shared/seed: show the proxy's reason as the error, instead of raw JSON.
  • The lender's vendor calls follow the switch with no restart. GET /api/targets and PUT /api/targets read and change it. Reset and readiness only ever use the app emulators.
  • UI: a non-dismissable banner for Demo Mode and Production Mode, where Production Mode is a warning. A gear overlay with a base URL field per vendor and Use emulator and Use service buttons. The page title is also the demo menu (one demo for now). The demo and the inspector share one header, title block included, with Demo and Demo Inspector as tabs doing the wayfinding, and the demo's progress lives above the router, so switching views keeps it. An arrow beside the tabs still opens the inspector in a second browser tab. The inspector tags each call that a dry run would have sent elsewhere. Apply stays disabled, with the reason, while a URL cannot be used.
  • web/packages/brand: add --ls-warning (amber) and a warning badge variant. The style guide has no warning color, so it is an addition like --ls-danger, documented in the brand README, which also drops the stale "SaaS Apps" wording. The overlay backdrop uses the palette's navy, not black.
  • Docs: apps/acme-commerce-lenders/docs/usage.md explains the modes.

There is no way to send a call to a vendor's service. An earlier version had a Live run style, which was removed in 2420493 because it needed credentials the demo does not have and made the demo look broken.

Tests

make vet                                                                                     # clean
make test                                                                                    # 15 packages ok, including new wire, seed, lender and api tests
pnpm --dir web lint                                                                          # clean
pnpm --dir web --filter @localstack-app-emulators/acme-commerce-lenders exec tsc --noEmit    # clean
pnpm --dir web --filter @localstack-app-emulators/acme-commerce-lenders test                 # 9 files, 45 tests passed
make check-kits check-samples                                                                # ok

Driven against the running demo (LocalStack Stripe, local Plaid and Xero): with Stripe and Xero pointed at https://api.stripe.com and https://api.xero.com, the whole flow ran from apply to settled. 14 of the 18 calls to read and connect carried would_send_to, only for Stripe and Xero. Pointing both back at the emulators returned to Demo Mode.

Related

Follows localstack-samples/localstack-app-emulators#17.

tela added 9 commits November 5, 2026 13:05
The demo must show that only the base URL changes between an app
emulator and the real vendor. A dry run builds and records the call
and sends nothing, and a live call carries no Authorization header, so
the demo never needs or touches a credential.
The presenter changes a vendor's base URL while the demo runs, so each
call asks the switch where its vendor is now. GET and PUT /api/targets
read and change it, and an invalid URL is reported before a run, not
after it fails.
A dry run or an unreachable URL reached the UI as raw JSON. The wire
proxy puts the reason in detail, so the error is now that sentence.
The presenter shows the mechanism by changing a vendor's base URL from
the emulator to its service. The non-dismissable banner says which mode
runs, the gear overlay edits each URL, and the inspector marks a dry run
as not sent.
Production Mode must say plainly what is and is not sent, since Live
puts real traffic on the network.
A dry run that stopped the flow read as a broken demo, and no vendor
credential is ever connected. A vendor pointed at its own URL is still
answered by the app emulator and the call records where it would have
gone. Live sends are removed.
The style guide has no warning color. Production Mode is not an error,
so it needs a color that reads as caution without borrowing the error
coral. Also corrects the stale 'SaaS Apps' wording in the brand README.
…mo menu

Production Mode now keeps the demo working: app emulators answer and the
inspector tags each call with where it would have gone. The run-style
buttons are gone with Live. The Demos button folds into the page title.
The demo holds no vendor credential and nobody should connect one, so
the guide now says the app emulator still answers every call.
@tela tela changed the title feat(demo): add Production Mode with dry-run and live base URLs feat(demo): add Production Mode as a dry-run warning Nov 5, 2026
tela added 4 commits November 5, 2026 13:50
The inspector was a separate page with its own header layout. Both
views now share the header with Demo and Demo Inspector as tabs, and the
demo's progress lives above the router so switching views keeps it. The
arrow beside the tabs still opens the inspector in a second browser tab.
The Open Demo Inspector button became a tab, so the usage guide and the
scenario describe the tabs and the arrow beside them.
With both views on one tab, the tabs say where you are, so the title,
the demo menu and the scenario panel are the same on each.
The Production Mode pill shrank to fit the banner text and wrapped onto
two lines. It now keeps its width and the text beside it wraps.
@tela
tela merged commit 580d59b into main Nov 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant